#include "sprite.h"
#include <iostream>
using namespace std;


float sprite::deltaTime=0.016;

int sprite::getDirection(){return this->direction;}
void sprite::setDirection(int dir){this->direction=dir;}
void sprite::setVelocity(float vel){this->Velocity=vel;}
void sprite::setLive(bool isLive){this->isLive=isLive;}

void sprite::run_right(float step)
{
    //原宽为2200
    this->x+=step;
    if(x>1920)
        x=1920;
    this->direction=1;
}
void sprite::run_up(float step)
{
    //原高1800
    y-=step;
    if(y<0)
        y=0;
    this->direction=0;
}
void sprite::run_down(float step)
{
    y+=step;
    if((y+100)>1500)
        y=1400;
    this->direction=2;
}
void sprite::run_left(float step)
{
    x-=step;
    if(x<0)
        x=0;
    this->direction=3;
}
